import homePage from '../commponents/homePage';
import dangerManagement from '../commponents/JH/dangerManagement'
import safetyInspection from '../commponents/JH/safetyInspection'
import reportDangers from '../commponents/JH/reportDangers';
import assign from '../commponents/JH/assign';
import result from '../commponents/JH/result';
import Verification from '../commponents/JH/verification';
import Report from '../commponents/JH/Look/report';
import LookChuli from '../commponents/JH/Look/lookChuli';
import LookYanzheng from '../commponents/JH/Look/lookYanzheng';
import LookFinish from '../commponents/JH/Look/lookFinish';
import addAdmin from '../commponents/JH/addAdmin';
// // 程佳顺
// import Account from '../commponents/CJS/Account'
// import Department from '../commponents/CJS/Department'
// import Escort from '../commponents/CJS/Escort/index'
// import Scheduling from '../commponents/CJS/Escort/Scheduling'
// import myRole from '../commponents/CJS/myRole'
// import addEscort from '../commponents/CJS/Escort/addEscort/index'
// import addClass from '../commponents/CJS/Escort/addClass/index'

// 郝璐
import studentManagement from '../commponents/HL/StudentManagement';
import classManagement from '../commponents/HL/classManagement';
import classTeacher from '../commponents/HL/classTeacher';
import SecurityManagement from '../commponents/HL/SecurityManagement';
import teacherManagement from '../commponents/HL/teacherManagement';
import workerManagement from '../commponents/HL/workerManagement';
import AddStudent from '../commponents/HL/studentmanage/addStudent';
import StudentManagEditor from '../commponents/HL/studentmanage/StudentManagEditor';
import SecurityStaff from '../commponents/HL/SecurityStaff';
import AddSecurityStaff from '../commponents/HL/SecurityStaff/AddSecurityStaff';
import EditorSecurityStaff from '../commponents/HL/SecurityStaff/EditorSecurityStaff'
// 李欢
import Edit from '../commponents/LH/Visitor/Edit';
import Rea from '../commponents/LH/Visitor/Rea';
import Leave from '../commponents/LH/Teacher/Leave';
import Visitor from '../commponents/LH/Visitor/Visitor';
import Apply from '../commponents/LH/Teacher/Apply';
import Details from '../commponents/LH/Teacher/Details';
import Immediately from '../commponents/LH/Teacher/Immediately';
import Vie from '../commponents/LH/Teacher/Vie';
import Edi from '../commponents/LH/Teacher/Edi';
import Rule from '../commponents/LH/Teacher/Rule';

export const allRoutes = [
    {
        path: "/homePage",
        component: homePage
    },
    {
        path: "/dangerManagement",
        component: dangerManagement
    },
    {
        path: "/safetyInspection",
        component: safetyInspection
    },
    {
        path: "/reportDangers",
        component: reportDangers
    },
    {
        path: "/assign",
        component: assign
    },
    {
        path: "/Report",
        component: Report
    },
    {
        path: "/Verification",
        component: Verification
    },
    {
        path: "/result",
        component: result
    },
    {
        path: "/LookChuli",
        component: LookChuli
    },
    {
        path: "/LookYanzheng",
        component: LookYanzheng
    },
    {
        path: "/LookFinish",
        component: LookFinish
    },
    {
        path: "/LookYanzheng",
        component: LookYanzheng
    },
    {
        path: "/addAdmin",
        component: addAdmin
    },
    {
        path: "/studentManagement",
        component: studentManagement
    },
    {
        path: "/classManagement",
        component: classManagement
    },
    {
        path: "/classTeacher",
        component: classTeacher
    },
    {
        path: "/SecurityManagement",
        component: SecurityManagement
    },
    {
        path: "/teacherManagement",
        component: teacherManagement
    },
    {
        path: "/workerManagement",
        component: workerManagement
    },
    {
        path: "/AddStudent",
        component: AddStudent
    },
    {
        path: "/StudentManagEditor",
        component: StudentManagEditor
    },
    {
        path: "/SecurityStaff",
        component: SecurityStaff
    },
    {
        path: "/AddSecurityStaff",
        component: AddSecurityStaff
    },
    {
        path: "/EditorSecurityStaff",
        component: EditorSecurityStaff
    },
    {
        path: "/Edit",
        component: Edit
    },
    {
        path: "/Rea",
        component: Rea
    },
    {
        path: "/Leave",
        component: Leave
    },
    {
        path: "/Visitor",
        component: Visitor
    },
    {
        path: "/Apply",
        component: Apply
    },
    {
        path: "/Details",
        component: Details
    },
    {
        path: "/Immediately",
        component: Immediately
    },
    {
        path: "/Vie",
        component: Vie
    },
    {
        path: "/Edi",
        component: Edi
    },
    {
        path: "/Rule",
        component: Rule
    },
]



export const getRouter = () => {
    let checkedKeys = []
    if (sessionStorage.getItem('grants')) {
        checkedKeys = JSON.parse(sessionStorage.getItem('grants'))
    }
    let currRouter = []; 
    allRoutes.forEach(item => {
        if (checkedKeys.some(m => m == `/Main${item.path}`)) {
            currRouter.push({ ...item })
        }
    })

    console.log('111');
    console.log(currRouter);
    return currRouter
}
